<?php

namespace app\validate\admin;

use think\Validate;

class ActivityValidate extends Validate
{
    protected $failException = true;

    protected $rule = [
        'title|活动名称' => 'require|max:64',
        "start_time|开始时间" => "require",
        "end_time|结束时间" => "require|checkEndTime",
        'rule|活动规则' => 'require',
        'pop_style|弹窗样式' => 'require|max:128',
    ];

    protected function checkEndTime($value)
    {
        if (strtotime($value) <= time()) {
            return '结束时间必须大于当前时间';
        }
        return true;
    }
}
